package com.kailong.entity.sys;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.List;

/**
 * created by kailong on 2025/8/4
 */

/**
 * 用户表 实体类
 * 对应数据库表：user
 */

@Setter
@Getter
@TableName("sys_user")
@Schema(description = "用户实体")
public class UserEntity {

    /** 主键ID */
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "主键ID")
    private Long id;

    /** 头像ID */
    @TableField("avatar_id")
    @Schema(description = "头像ID")
    private Long avatarId;

    /** 邮箱 */
    @TableField("email")
    @Schema(description = "邮箱")
    private String email;

    /** 密码 */
    @TableField("password")
    @Schema(description = "密码")
    private String password;

    /** 用户名 */
    @TableField("user_name")
    @Schema(description = "用户名")
    private String userName;

    /** 部门ID */
    @TableField("dept_id")
    @Schema(description = "部门ID")
    private Long deptId;

    /** 手机号码 */
    @TableField("phone")
    @Schema(description = "手机号码")
    private String phone;

    /** 岗位ID */
    @TableField("job_id")
    @Schema(description = "岗位ID")
    private Long jobId;

    /** 最后修改密码的时间 */
    @TableField("last_change_password_time")
    @Schema(description = "最后修改密码的时间")
    private Date lastChangePasswordTime;

    /** 别名 */
    @TableField("nick_name")
    @Schema(description = "别名")
    private String nickName;

    /** 性别 1:男 2:女 */
    @TableField("sex")
    @Schema(description = "性别 1:男 2:女")
    private Integer sex;

    /** 有效状态 1:有效 0:无效 */
    @TableField("valid_status")
    @Schema(description = "有效状态 1:有效 0:无效")
    private Integer validStatus;

    /** 创建人ID */
    @TableField("create_user_id")
    @Schema(description = "创建人ID", required = true)
    private Long createUserId;

    /** 创建人名称 */
    @TableField("create_user_name")
    @Schema(description = "创建人名称", required = true)
    private String createUserName;

    /** 创建日期 */
    @TableField("create_time")
    @Schema(description = "创建日期", required = true)
    private Date createTime;

    /** 修改人ID */
    @TableField("update_user_id")
    @Schema(description = "修改人ID")
    private Long updateUserId;

    /** 修改人名称 */
    @TableField("update_user_name")
    @Schema(description = "修改人名称")
    private String updateUserName;

    /** 修改日期 */
    @TableField("update_time")
    @Schema(description = "修改日期")
    private Date updateTime;

    /** 逻辑删除标识：1 已删除 0: 未删除 */
    @TableField("is_del")
    @Schema(description = "逻辑删除标识")
    private Integer isDel;
    /**
     * 角色列表
     */
    @TableField(exist = false)
    @Schema(description = "角色列表")
    private List<RoleEntity> roles;

    @Override
    public String toString() {
        return "UserEntity{" +
                "id=" + id +
                ", avatarId=" + avatarId +
                ", email='" + email + '\'' +
                ", password='" + password + '\'' +
                ", userName='" + userName + '\'' +
                ", deptId=" + deptId +
                ", phone='" + phone + '\'' +
                ", jobId=" + jobId +
                ", lastChangePasswordTime=" + lastChangePasswordTime +
                ", nickName='" + nickName + '\'' +
                ", sex=" + sex +
                ", validStatus=" + validStatus +
                ", createUserId=" + createUserId +
                ", createUserName='" + createUserName + '\'' +
                ", createTime=" + createTime +
                ", updateUserId=" + updateUserId +
                ", updateUserName='" + updateUserName + '\'' +
                ", updateTime=" + updateTime +
                ", isDel=" + isDel +
                ", roles=" + roles +
                '}';
    }
}
